package com.gdth.http.method;

import com.gdth.bank.model.TAppTokenModel;
import com.gdth.coder.CodeUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/** 
 * @author  Arvin: 
 * @version 2016年6月1日 下午4:09:49 
 * 
 */
public class HttpUtil {
	public static Gson getGsonFormat(){
    	Gson gson = new GsonBuilder()
        .setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
        .create();
    	
    	return gson;
    	
    }
	
	public static String[] getContentByEncode(String content) {
		//参数加密
		String token = TAppTokenModel.getCurrentToken();
        String privateKey = TAppTokenModel.getPrivateKey();
        String sPublicKey = TAppTokenModel.getPublicKeyForServer();
        
        if (content == null || content.equals("")) {
        	content = "content";
        }
        String encodedData = CodeUtil.encryptByPublicForLong(content, sPublicKey);
        String sign = CodeUtil.newSign(encodedData, privateKey);
        
        return new String[]{encodedData, sign, token};
	}
}
